<template>
  <div>
    <div
      class="item-box"
      v-for="(item, index) in list"
      :key="index"
      @click="goMessage(item)"
    >
      <div class="img-box" v-if="item.thumb_image">
        <img :src="sourceURL + item.thumb_image" alt="" />
      </div>
      <div class="img-box" v-else>
        <img src="../../assets/images/news-list-img.jpg" alt="" />
      </div>
      <div class="right-box">
        <div class="title">{{ item.title }}</div>
        <div class="introduce-style">{{ item.introduce }}</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["list"],
  methods: {
    /*热门资讯*/
    goMessage(item) {
      this.$router.push({ name: "messageDetail", query: { id: item.id } });
    },
  },
};
</script>
<style lang="scss" scoped>

.item-box {
  display: flex;
  align-items: center;
  width: 95%;
  line-height: 20px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 1);
  margin: 17px 8px;
  padding: 10px 12px;
  box-sizing: border-box;
  .img-box {
    width: 100px;
    height: 93px;
    overflow: hidden; /* 隐藏超出容器的部分 */
    flex-shrink:0;
    img {
      width: 100%;
      height: 100%;
      object-fit: cover; /* 等比例缩放并裁剪，保持图片不变形 */
    }
  }
  .right-box {
    margin-left: 15px;
    .title {
      color: rgba(16, 16, 16, 1);
      font-size: 14px;
      text-align: left;
      font-family: SourceHanSansSC-regular;
      font-weight: bold;
    }

    .introduce-style {
      color: rgba(153, 153, 153, 1);
      font-size: 12px;
      text-align: left;
      font-family: PingFangSC-regular;
    }
  }
}
</style>